<template>
  <div>
    <editForm :formData="formData"/>
  </div>
</template>

<script>
import {getEditForm} from "@/api";
import editForm from "@/components/public/editForm";

export default {
  name: "Edit",
  components: {
    editForm
  },
  data() {
    return {
      formData: []
    }
  },
  created() {
    this.getEditForm()
  },
  methods: {
    getEditForm() {
      let params = {user_id: 1, form_id: 14, activity_id: 1}
      getEditForm(params).then(response => {
        console.log(response)
        let formData = response
        formData.map(item => {
          if (item.type == 'switch') {
            if (item.value == true || item.value == 'true') item.value = true
          }
        })
        this.formData = formData
      }).catch(error => console.log(error))
    }
  }
}
</script>

<style scoped>

</style>